home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / JForth / Extras / SysGen / AUTO < prev    next >
Encoding:
Text File  |  1992-01-25  |  1.5 KB  |  66 lines

  1. \ Execute CLI command line
  2. \ Define automatic actions for BYE
  3. \
  4. \ Your AUTO.xxxx words should call the previous AUTO.xxxx, eg.
  5. \
  6. \ : AUTO.INIT  auto.init init.my.stuff ;
  7. \    then in some other file
  8. \ : AUTO.INIT  auto.init init.other.stuff ;
  9. \
  10. \ Author: Phil Burk  8/16/88
  11. \ Copyright 1988 Phil Burk
  12.  
  13. \ 00001 07-aug-91 mdh  Added JSTARTED examination so clicmd is done once
  14. \ 00002 16-aug-91 plb  SAVE-FORTH calls AUTO.TERM and AUTO.INIT
  15. \          Added FIND&EXECUTE
  16. \ 00003 19-aug-91 Turn JSTARTED ON in AUTO.EXEC.CLI to avoid
  17. \          SAVE-FORTH from command line.
  18. \ 00004 25-jan-92 Cleaned-up output. added AUTO.TERM.ALL and COLD
  19.  
  20. ANEW TASK-AUTO
  21.  
  22. : AUTO.TERM  ( -- , should be called by all others )
  23.     >newline ." AUTO.TERM" cr
  24. ;
  25.  
  26. : FIND&EXECUTE ( $name -- , 00002 )
  27.     find
  28.     IF execute
  29.     ELSE   >newline ( 00004 )   $type ."  not found!" cr
  30.     THEN
  31. ;
  32.  
  33. : BYE  ( -- , call cleanup words )
  34.     " AUTO.TERM" find&execute \ 00002
  35.     bye
  36. ;
  37.  
  38. : AUTO.EXEC.CLI ( -- , execute Forth commands following CLI command )
  39.   JSTARTED @ 0=   \ 00001
  40.   IF   \ 00001
  41.       JSTARTED ON \ 00003
  42.      clicommand count bl scan
  43.      >newline 2dup type cr   \ 00004
  44.      $interpret
  45.   THEN \ 00001
  46. ;
  47.  
  48. : AUTO.INIT ( -- , make auto.exec.cli part of startup )
  49.     auto.init  \ MUST call this!
  50.     auto.exec.cli
  51. ;
  52.  
  53. : AUTO.TERM.ALL  ( -- )  \ 00004
  54.   " AUTO.TERM" find&execute
  55. ;
  56.  
  57. : SAVE-FORTH ( -- , cleanup before saving, 00002 )
  58.     AUTO.TERM.ALL  \ 00004
  59.     save-forth
  60.     " AUTO.INIT" find&execute
  61. ;
  62.  
  63. : COLD  ( -- )   \ 00004
  64.   AUTO.TERM.ALL   cold
  65. ;
  66.